#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    void rotate(vector<int> &nums, int k)
    {
        k = k % nums.size();
        reverse(nums.begin(), nums.end());
        auto it = nums.begin();
        reverse(nums.begin(), it + k);
        reverse(it + k, nums.end());
    }
};